﻿using System;
using Microsoft.AspNetCore.Mvc;
using VegetableSale.NET.Entities;
using VegetableSale.NET.Services;

[ApiController]
[Route("api/[Action]")]
public class CustomerController : Controller
{
    private CustomerService customerService = new CustomerService();

    [HttpPost(Name = "customerlist")]
    public Result customerlist([FromBody] QueryDTO queryDTO)
    {
        return customerService.getCustList(queryDTO);
    }

    [HttpPost(Name = "custadd")]
    public Result custadd([FromBody]QueryCustomer querycustomer)
    {
        return customerService.addCustomer(querycustomer);
    }

    [HttpPost(Name = "custdelete")]
    public Result custdelete(int custid)
    {
        return customerService.custdelete(custid);
    }

    [HttpPost(Name = "custupdate")]
    public Result custupdate([FromBody] Customer customer)
    {
        return customerService.custupdate(customer);
    }
    
    [HttpPost(Name = "custAllCust")]
    public Result custAllCust()
    {
        return customerService.getAllCust();
    }

}

